package com.bootdo.mall.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.bootdo.mall.dao.MallIndexCategoryJoinDao;
import com.bootdo.mall.domain.MallIndexCategoryJoin;
import com.bootdo.mall.service.MallIndexCategoryJoinService;



@Service
public class MallIndexCategoryJoinServiceImpl implements MallIndexCategoryJoinService {
	@Autowired
	private MallIndexCategoryJoinDao mallIndexCategoryJoinDao;
	
	@Override
	public MallIndexCategoryJoin get(Long id){
		return mallIndexCategoryJoinDao.get(id);
	}

	@Override
	public MallIndexCategoryJoin getIndexCategoryIdAndTypeAndRefId(Integer type, Long indexCategoryId, Long refId) {
		return mallIndexCategoryJoinDao.getIndexCategoryIdAndTypeAndRefId(type, indexCategoryId, refId);
	}

	@Override
	public List<MallIndexCategoryJoin> list(Map<String, Object> map){
		return mallIndexCategoryJoinDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return mallIndexCategoryJoinDao.count(map);
	}
	
	@Override
	public int save(MallIndexCategoryJoin mallIndexCategoryJoin){
	
		if(mallIndexCategoryJoin.getId() != null) {
			return mallIndexCategoryJoinDao.update(mallIndexCategoryJoin);
		}else {
			return mallIndexCategoryJoinDao.save(mallIndexCategoryJoin);
		}		
	
		
	}
	
	@Override
	public int update(MallIndexCategoryJoin mallIndexCategoryJoin){
		return mallIndexCategoryJoinDao.update(mallIndexCategoryJoin);
	}
	
	@Override
	public int remove(Long id){
		return mallIndexCategoryJoinDao.remove(id);
	}

	@Override
	public int removeByTypeIdAndIndexCategoryId(Integer type, Long indexCategoryId) {
		return mallIndexCategoryJoinDao.removeByTypeIdAndIndexCategoryId(type, indexCategoryId);
	}

	@Override
	public int batchRemove(Long[] ids){
		return mallIndexCategoryJoinDao.batchRemove(ids);
	}
	
}
